﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using 个人博客.SqlViews;

namespace 个人博客.instrumentClass
{
    //修改密码
    public class alterPwd
    {
        //查询账号存在
        public bool exist(int number) {
            using (var db = new Model1())
            {
                var list = db.Blogs_Account.FirstOrDefault(u => u.acc_number == number);
                if (list == null) {
                    return false;
                }
                return true;
            }
        }
        //查询账号雨邮箱是否正确
        public bool correct(int number, string gmail) {
            using (var db = new Model1())
            {
                var list = db.Blogs_Account.FirstOrDefault(u => u.acc_number == number);
                if (list.acc_gmail != gmail)
                {
                    return false;
                }
                return true;
            }
        }
        //修改密码
        public void modification(int number, string pwd) {
            using (var db = new Model1())
            {
                var list = db.Blogs_Account.FirstOrDefault(u => u.acc_number == number);
                if (list != null) {
                    list.acc_pwd = pwd;
                    db.SaveChanges();
                }
            }
        }
    }
}